//
//  Product.h
//  iFlower
//
//  Created by thohd on 7/26/10.
//  Copyright 2010 iNIL.me. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol ProductDelegate;

@interface Product : NSObject {
@private
	NSString* productId_;
	NSString* productCode_;
	NSString* price_;
	NSString* product_;
	NSString* shortdesc_;
	//NSString* discount_;
	NSString* fulldesc_;
	NSURL* thumbnailURL_;
	UIImage* thumbnail_;
	NSInteger amount_;
    // Why NSObject instead of "id"? Because this way
    // we can ask if it "respondsToSelector:" before invoking
    // any delegate method...
    NSObject<ProductDelegate> *delegate;
}

@property (nonatomic,retain) NSString* provider;
@property (nonatomic,retain) NSString* productId;
@property (nonatomic,assign) NSInteger amount;
@property (nonatomic,retain) NSString* productCode;
@property (nonatomic,retain) NSString* price;
@property (nonatomic,retain) NSString* product;
@property (nonatomic,retain) NSString* shortdesc;
@property (nonatomic,retain) NSString* fulldesc;
@property (nonatomic,retain) NSURL* thumbnailURL;
@property (nonatomic,retain) UIImage* thumbnail;
@property (nonatomic,retain) NSObject<ProductDelegate> *delegate;

- (BOOL)hasLoadedThumbnail;

@end

@protocol ProductDelegate
@required
- (void)product:(Product *)item couldNotLoadImageError:(NSError *)error;

@optional
- (void)product:(Product *)item didLoadImage:(UIImage *)image;
- (void)product:(Product *)item didLoadThumbnail:(UIImage *)image;

@end
